/*
 * Amaze - QT downloader for the Amazon MP3 store
 * Copyright (c) 2010-2011 Robert Keevil
 *
 * This program is free software: you can redistribute it and/or
 * modify it under the terms of the GNU General Public License as
 * published by the Free Software Foundation, either version 3 of the
 * License, or (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 *
 * You should have received a copy of the GNU General Public License
 * along with this program.  If not, see <http://www.gnu.org/licenses/>.
 */

#ifndef COMMON_H
#define COMMON_H

#include <QString>

#define AMAZE_NAME     "Amaze"
#define AMAZE_VERSION  0.2

enum track_state {
    TRACK_NEW,
    TRACK_DOWNLOADING,
    TRACK_SUCCESS,
    TRACK_ERROR
};

struct track {
    QString     url;
    QString     artist;
    QString     album;
    QString     title;
    QString     image_url;
    QString     duration;
    QString     tracknum;
    QString     asin;
    QString     product_type;
    QString     genre;
    qint64      filesize;
    QString     discnum;
    QString     album_asin;
    QString     album_artist;
    QString     track_type;
    track_state state;
    QString     msg;
    QString     filepath;
};

// XML values from the .amz file
const QString AMZ_LOCATION         = "location";
const QString AMZ_ARTIST           = "creator";
const QString AMZ_ALBUM            = "album";
const QString AMZ_TITLE            = "title";
const QString AMZ_IMAGE            = "image";
const QString AMZ_LENGTH           = "duration";
const QString AMZ_TRACKNUM         = "trackNum";
const QString AMZ_META_ASIN        = "http://www.amazon.com/dmusic/ASIN";
const QString AMZ_META_PRODUCTTYPE = "http://www.amazon.com/dmusic/productTypeName";
const QString AMZ_META_GENRE       = "http://www.amazon.com/dmusic/primaryGenre";
const QString AMZ_META_FILESIZE    = "http://www.amazon.com/dmusic/fileSize";
const QString AMZ_META_DISCNUM     = "http://www.amazon.com/dmusic/discNum";
const QString AMZ_META_ALBUMASIN   = "http://www.amazon.com/dmusic/albumASIN";
const QString AMZ_META_ALBUMARTIST = "http://www.amazon.com/dmusic/albumPrimaryArtist";
const QString AMZ_META_TRACKTYPE   = "http://www.amazon.com/dmusic/trackType";

// internal values
const QString AMAZE_ARTIST      = "%ARTIST%";
const QString AMAZE_ALBUM       = "%ALBUM%";
const QString AMAZE_TITLE       = "%TITLE%";
const QString AMAZE_TRACKNUM    = "%TRACKNUM%";
const QString AMAZE_GENRE       = "%GENRE%";
const QString AMAZE_DISCNUM     = "%DISCNUM%";
const QString AMAZE_ALBUMARTIST = "%ALBUMARTIST%";
const QString AMAZE_TRACKTYPE   = "%TRACKTYPE%";

const QString AMAZE_DEFAULT_FORMAT = "%ALBUMARTIST%/%ALBUM%/%TRACKNUM% - %TITLE%";

enum LOG_LEVEL {
    LOG_ERROR,
    LOG_INFO,
    LOG_DEBUG,
    LOG_TRACE,
    LOG_NUM_LEVELS
};

const LOG_LEVEL LOG_DEFAULT = LOG_INFO;

const QString LOG_LEVEL_NAMES[LOG_NUM_LEVELS] = {
    "ERROR",
    "INFO",
    "DEBUG",
    "TRACE"
};

struct log_entry {
    LOG_LEVEL level;
    QString msg;
};

#endif // COMMON_H
